package com.nexus.service.sys.service.mapstruct;


import com.nexus.core.service.mapstruct.BaseConverter;
import com.nexus.core.sys.dto.SysLogDTO;
import com.nexus.core.sys.entity.SysLog;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

/**
 * SysLogWrapper
 *
 * @author 路正宁
 * @version 2023-03-15
 */
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = {})
public interface SysLogWrapper extends BaseConverter<SysLog, SysLogDTO> {

    SysLogWrapper INSTANCE = Mappers.getMapper(SysLogWrapper.class);

    @Mappings({
            @Mapping(source = "org.id", target = "org"),
            @Mapping(source = "createBy.id", target = "createBy"),
            @Mapping(source = "updateBy.id", target = "updateBy")})
    SysLog toEntity(SysLogDTO dto);


    @Mappings({
            @Mapping(source = "org", target = "org.id"),
            @Mapping(source = "createBy", target = "createBy.id"),
            @Mapping(source = "updateBy", target = "updateBy.id")})
    SysLogDTO toDTO(SysLog entity);
}

